home *** CD-ROM | disk | FTP | other *** search
- Path: athena.ulaval.ca!news
- From: Ferid Baklouti <baklouti@ift.ulaval.ca>
- Newsgroups: comp.lang.c
- Subject: HELP...HELP
- Date: Fri, 12 Apr 1996 20:34:41 -0400
- Organization: Universite Laval
- Message-ID: <316EF6A1.41C6@ift.ulaval.ca>
- NNTP-Posting-Host: pegase.ift.ulaval.ca
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; IRIX 5.3 IP22)
-
- Hello everyone,
-
- imagine this command under a unix system :
-
- program1 < file | program2 | program3 > file.results
-
- i want the "program2" to be able to detect the name of "file" given on
- the standard input <stdin> to the program1.
-
-
-
- in the file stdio.h, I only find the things below which doesn't contain
- the name of the file.
-
- -----------------------------------------------------------------------
-
-
- more stdio.h
- /* @(#)stdio.h 1.16 89/12/29 SMI; from UCB 1.4 06/30/83 */
-
- # ifndef FILE
- #define BUFSIZ 1024
- #define _SBFSIZ 8
- extern struct _iobuf {
- int _cnt;
- unsigned char *_ptr;
- unsigned char *_base;
- int _bufsiz;
- short _flag;
- char _file; /* should be short */
- } _iob[];
-
- #define _IOFBF 0
- #define _IOREAD 01
- #define _IOWRT 02
- #define _IONBF 04
- #define _IOMYBUF 010
- #define _IOEOF 020
- #define _IOERR 040
- #define _IOSTRG 0100
- #define _IOLBF 0200
- #define _IORW 0400
- #define NULL 0
- #define FILE struct _iobuf
- #define EOF (-1)
-
- #define stdin (&_iob[0])
- #define stdout (&_iob[1])
- #define stderr (&_iob[2])
-
- #ifdef lint /* so that lint likes (void)putc(a,b) */
- extern int putc();
- extern int getc();
- #else
- #define getc(p) (--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p))
- #define putc(x, p) (--(p)->_cnt >= 0 ?\
- (int)(*(p)->_ptr++ = (unsigned char)(x)) :\
- (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
- ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\
- (int)(*(p)->_ptr++) :\
- _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
- _flsbuf((unsigned char)(x), p)))
- #endif
- #define getchar() getc(stdin)
- #define putchar(x) putc((x),stdout)
- #define feof(p) (((p)->_flag&_IOEOF)!=0)
- #define ferror(p) (((p)->_flag&_IOERR)!=0)
- #define fileno(p) ((p)->_file)
- #define clearerr(p) (void) ((p)->_flag &= ~(_IOERR|_IOEOF))
-
- extern FILE *fopen();
- extern FILE *fdopen();
- extern FILE *freopen();
- extern FILE *popen();
- extern FILE *tmpfile();
- extern long ftell();
- extern char *fgets();
- extern char *gets();
- extern char *sprintf();
- extern char *ctermid();
- extern char *cuserid();
- extern char *tempnam();
- extern char *tmpnam();
-
- #define L_ctermid 9
- #define L_cuserid 9
- #define P_tmpdir "/usr/tmp/"
- #define L_tmpnam 25 /* (sizeof(P_tmpdir) + 15) */
- # endif
-
- -----------------------------------------------------------------------
-
- thanks a lot.
-
- Ferid
-